$(document).ready(function () {
document.documentElement.setAttribute("lang", $("#HiddenLanguageParameter").val());
loadHelp()
let slotsWithOutHistory = ["christmas", "pharaoh", "donutcity", "sport", "casino", "galaxy", "birds", "dota", "cityslot", "carsslot", 'luckyfisher', 'flowers', 'happydiver', 'luckyhunter', 'donuts', 'lotslot', 'fruitbar', 'geniesbonanza', 'multihotways', 'wildsandgods', 'foxyhot20', 'wildmultistars', 'bookoffuturia', 'bookofbonanza', 'hotsamba'];
function swipeLeft() {
setTimeout(() => {
if ($(".footer-navigation a.active:visible").next().is(":visible")) {
$(".footer-navigation a.active").next().trigger("click")
$(".menu-popup-page" + $(".footer-navigation a.active").next().attr("data-page"))
} else {
$(".footer-navigation a.active").next().next().trigger("click")
}
}, 100);
}
function swipeRight() {
setTimeout(() => {
if ($(".footer-navigation a.active").prev().is(":visible")) {
$(".footer-navigation a.active").prev().trigger("click")
} else {
$(".footer-navigation a.active").prev().prev().trigger("click")
}
}, 100);
}
function swipeMenuContent() {
(function (d) {
var
ce = function (e, n) {
var a = document.createEvent("CustomEvent");
a.initCustomEvent(n, true, true, e.target);
e.target.dispatchEvent(a);
a = null;
return false
},
nm = true,
sp = {
x: 0,
y: 0
},
ep = {
x: 0,
y: 0
},
touch = {
touchstart: function (e) {
sp = {
x: e.touches[0].pageX,
y: e.touches[0].pageY
}
},
touchmove: function (e) {
nm = false;
ep = {
x: e.touches[0].pageX,
y: e.touches[0].pageY
}
},
touchend: function (e) {
if (nm) {
ce(e, 'fc')
} else {
var x = ep.x - sp.x,
xr = Math.abs(x),
y = ep.y - sp.y,
yr = Math.abs(y);
if (Math.max(xr, yr) > 100) {
ce(e, (xr > yr ? (x < 0 ? 'swl' : 'swr') : (y < 0 ? 'swu' : 'swd')))
}
};
nm = true
},
touchcancel: function (e) {
nm = false
}
};
touchDesktop = {
mousedown: function (e) {
sp = {
x: e.pageX,
y: e.pageY
}
},
mousemove: function (e) {
nm = false;
ep = {
x: e.pageX,
y: e.pageY
}
},
mouseup: function (e) {
if (nm) {
ce(e, 'fc')
} else {
var x = ep.x - sp.x,
xr = Math.abs(x),
y = ep.y - sp.y,
yr = Math.abs(y);
if (Math.max(xr, yr) > 100) {
ce(e, (xr > yr ? (x < 0 ? 'swl' : 'swr') : (y < 0 ? 'swu' : 'swd')))
}
};
nm = true
},
touchcancel: function (e) {
nm = false
}
};
for (var a in touch) {
d.addEventListener(a, touch[a], false);
}
for (var a in touchDesktop) {
d.addEventListener(a, touchDesktop[a], false);
}
})(document);
document.querySelector('.menu-popup-content').addEventListener('swl', swipeLeft, false);
document.querySelector('.menu-popup-content').addEventListener('swr', swipeRight, false);
}
swipeMenuContent()
let globalParams = {};
function GetCaption(captionKey) {
if (captionKey !== undefined && captionKey !== null && captionKey.constructor === Array) {
let captionArray = [];
for (let i = 0; i < captionKey.length; i++)
captionArray[i] = GetCaption(captionKey[i]);
return captionArray;
} else {
let caption = formatGlobalParameters(locale[captionKey], globalParams);
return caption !== undefined ? caption : captionKey;
}
}
function formatGlobalParameters(captionValue, globalParamaters) {
if (captionValue) {
const regex = /\{([^\}]+)\}/g;
return captionValue.replace(regex, function ($0) {
return globalParamaters[$0.substring(1, $0.length - 1)];
});
}
return captionValue
}
let getCaption = () => {
$("captionKey").each(function (e) {
let attr = GetCaption($(this).data('caption'));
$(this).html(attr);
});
};
getCaption();
let clickEvent = 'click';
let iframe = document.querySelector('#game-frame');
// let iframeHistory = document.querySelector('#historyIframe');
document.querySelector(".checkbox-for-sound").addEventListener(clickEvent, function () {
buttonClickSound();
});
document.querySelector(".checkbox-for-music").addEventListener(clickEvent, function () {
buttonClickSound();
});
document.querySelector(".checkbox-for-full-screen").addEventListener(clickEvent, function () {
buttonClickSound();
});
document.querySelector(".input-for-full-screen").addEventListener("change", function () {
if (document.querySelector(".input-for-full-screen").checked) {
window.parent.postMessage({ name: "fullscreen-on" }, "*")
launchFullscreen(document.documentElement);
} else {
window.parent.postMessage({ name: "fullscreen-off" }, "*")
exitFullscreen()
}
})
document.querySelector(".menu-line-sound-icon").addEventListener("click", function () {
iframe.contentWindow.postMessage({ name: "sound-toggle" }, "*");
$(this).toggleClass("active")
if ($(this).hasClass("active")) {
document.querySelector(".input-for-sound").checked = true;
} else {
document.querySelector(".input-for-sound").checked = false;
}
})
let bgMusicChecked
document.querySelector(".input-for-background-music").addEventListener("change", function () {
//if(document.querySelector(".input-for-sound").checked){
iframe.contentWindow.postMessage({ name: 'background-music-toggle' }, "*");
if (document.querySelector(".input-for-background-music").checked) {
bgMusicChecked = false
} else {
bgMusicChecked = true
}
//}
})
document.querySelector(".input-for-sound").addEventListener("change", function () {
if (document.querySelector(".input-for-sound").checked) {
document.querySelector(".menu-line-sound-icon").classList.add("active")
document.querySelector(".input-for-background-music").checked = true
if (typeof FEIM !== 'undefined') FEIM.send.updateSettings({ sounds: true });
if (bgMusicChecked === true) {
bgMusicChecked = false
iframe.contentWindow.postMessage({ name: 'background-music-toggle' }, "*");
}
} else {
document.querySelector(".menu-line-sound-icon").classList.remove("active")
document.querySelector(".input-for-background-music").checked = false
if (typeof FEIM !== 'undefined') FEIM.send.updateSettings({ sounds: false });
}
iframe.contentWindow.postMessage({ name: "sound-toggle" }, "*");
})
// document.querySelector(".input-for-left-hand").addEventListener("click",function(){
// iframe.contentWindow.postMessage('left-hand-mode-toggle', "*");
// })
document.querySelector(".menu-popup-exit-game").addEventListener("click", function () {
iframe.contentWindow.postMessage({ name: 'exit-game' }, "*");
})
$(document).on(clickEvent, '.footer-page-rules', function (event) {
showHelp()
});
window.addEventListener("message", function (event) {
let message = event.data;
if (message === 'update.balance') {
iframe.contentWindow.postMessage('update.balance', "*");
}
if (message.name !== undefined) {
if (message.name === 'sound-popup-on') {
document.querySelector(".input-for-sound").checked = true;
document.querySelector(".input-for-background-music").checked = true;
if (bowser.mobile) document.querySelector(".input-for-full-screen").checked = true;
document.querySelector(".menu-line-sound-icon").classList.add("active")
} else if (message.name === 'sound-popup-off') {
document.querySelector(".input-for-sound").checked = false;
document.querySelector(".input-for-background-music").checked = false;
if (bowser.mobile) document.querySelector(".input-for-full-screen").checked = true;
document.querySelector(".menu-line-sound-icon").classList.remove("active");
} else if (message.name == "bg-music") {
if (event.data.backgroundMusic === false) {
document.querySelector(".input-for-background-music").checked = true;
} else {
bgMusicChecked = true
document.querySelector(".input-for-background-music").checked = false;
}
} else if (message.name == "jackpot-url") {
$("#jackpotIframe").attr("src", event.data.jackpotUrl);
$("#jackpotIframe").css('width', '344px')
} else if (message.name === "spin-number") {
$(".spinId-number").html("#" + event.data.spinNumber)
} else if (message.name === "swipe-left") {
swipeLeft()
} else if (message.name === "swipe-right") {
swipeRight()
} else if (message.name === "autoplay-popup-true") {
$(".show-menu-container").css("visibility", "hidden")
} else if (message.name === "autoplay-popup-false") {
$(".show-menu-container").css("visibility", "visible")
} else if (message.name === "hidden-menu-icon") {
$(".show-menu-container").css("visibility", "hidden");
} else if (message.name === "visible-menu-icon") {
$(".show-menu-container").css("visibility", "visible");
} else if (message.name === "game-sound-bt-status") {
if (event.data.active) {
$(".game-sound-bt").addClass("active")
}
} else if (message.name === "game-music-bt-status") {
if (event.data.active) {
$(".game-music-bt").addClass("active")
}
} else if (message.name === "menu-div-scale") {
$(".menu-div").css(event.data.scale)
} else if (message.name === "close-history-desktop") {
// $(".history-iframe-desktop-container").fadeOut(100)
} else if (message.name === "launch-full-screen-keno") {
launchFullscreen(document.documentElement);
document.querySelector(".input-for-full-screen").checked = true
} else if (message.name === 'global-params') {
globalParams = event.data.globalParams;
} else if (message.name === 'icon-scale-keno') {
// if($("#HiddenGameName").val().toLowerCase() === "russiankeno"){
// $(".menu-icon-without-line").css('transform','scale('+ event.data.iconScale * 2 + ')')
// }else{
// $(".menu-icon-without-line").css('transform','scale('+ event.data.iconScale + ')')
// }
} else if (message.name === 'boardinfo-keno') {
if (event.data.gameState === "Spinning") {
$(".menu-icon-without-line").css("pointer-events", "none");
} else {
$(".menu-icon-without-line").css("pointer-events", "");
}
} else if (message.name === 'sound-status') {
if (event.data.status === false) {
document.querySelector(".input-for-sound").checked = true;
document.querySelector(".input-for-background-music").checked = true;
} else {
document.querySelector(".input-for-sound").checked = false;
document.querySelector(".input-for-background-music").checked = false;
}
} else if (message.name === 'loaded') {
// iframeHistory.onload = function() {
// iframeHistory.contentWindow.postMessage({name:'locale-object',locale:locale,language:$("#HiddenLanguageParameter").val()}, "*");
// }
// let iframeHistoryDesktop = document.getElementById("history-iframe-desktop");
// iframeHistoryDesktop.onload = function() {
// iframeHistoryDesktop.contentWindow.postMessage({name:'locale-object',locale:locale,language:$("#HiddenLanguageParameter").val()}, "*");
// }
$("#body").attr("data-lang", $("#HiddenLanguageParameter").val());
let hiddenCurrencyCode = $("#HiddenCurrencyCode").val();
let hiddenTokenKey = $("#HiddenTokenKey").val();
let hiddenGameName = $("#HiddenGameName").val().charAt(0).toUpperCase() + $("#HiddenGameName").val().slice(1);
let url = `/menuapi/Menu/GetMenu/${hiddenGameName}/${hiddenCurrencyCode}`
let gameUrl = getUrl(hiddenGameName, hiddenTokenKey, hiddenCurrencyCode)
loadHelp();
$("#body").attr("data-category", $('#HiddenCategory').val())
let gameCategory = $("#body").attr("data-category");
let gameName = $("#HiddenGameName").val().toLowerCase();
$("#body").attr("data-game", gameName)
// if(!bowser.mobile){
// if(gameCategory === "Slots"){
// $(".menu-div").css("display","block")
// if(!slotsWithOutHistory.includes(gameName) ){
// $(".game-history-bt").css("display","block")
// if(data.HistoryUrl !== null || data.HistoryUrl !== undefined){
// $("#history-iframe-desktop").attr("src",data.HistoryUrl)
// }
// }
// }
// }
let similarGameArrow = ` `
$(".statistic-page-footer").empty();
$(".statistic-page-footer").append(similarGameArrow);
$(".current-wins-tbody").empty();
$(".top-wins-tbody").empty();
if (gameCategory === "XGames" || gameCategory === "Keno" || (gameCategory === "Slots" && !slotsWithOutHistory.includes(gameName))) {
$(".show-menu-container").css("display", "block");
} else {
$(".show-menu-container").css("display", "none");
if (slotsWithOutHistory.includes(gameName)) {
iframe.contentWindow.postMessage({ name: 'show-old-desktop-menu' }, "*");
}
}
if (gameCategory === "Slots" && (gameName.toLowerCase() !== 'football' && gameName.toLowerCase() !== 'bookofwin')) {
if (!$("#body").hasClass("has-history-tab")) {
$("#body").addClass("has-history-tab")
}
if ($("#body").hasClass("hasnot-jackpot")) {
$("#body").removeClass("hasnot-jackpot");
}
} else {
$("#body").removeClass("has-history-tab");
if ($("#body").hasClass("hasnot-jackpot")) {
$("#body").addClass("hasnot-jackpot");
}
}
if (bowser.mobile) {
$("#body").attr("data-mobile", "true")
} else {
document.querySelector(".input-for-full-screen").checked = false;
document.querySelector(".input-for-sound").checked = true;
$("#body").attr("data-mobile", "false")
}
}
else if (message.name === 'update.balance') {
iframe.contentWindow.postMessage('update.balance', "*");
} else if (message.name === 'stopAutospins') {
iframe.contentWindow.postMessage({ name: 'stopAutospins' }, "*");
} else if (message.name === 'trigger-menu-icon') {
$('.menu-icon-without-line.open-menu').trigger(clickEvent);
} else if(message.name === 'chat') {
iframe.contentWindow.postMessage({name: 'chat', value: getParameterByName('chat')}, "*");
} else {
}
}
});
function menuData(data) {
if (data.Message !== "general.error" && data.Message !== undefined) {
if (data.TopWins) {
for (let i = 0; i < data.TopWins.length; i++) {
let htmlTopWins;
if (data.TopWins[i].GameCategory !== "JetX") {
htmlTopWins = `
${data.TopWins[i].MaskDisplayName}
${data.TopWins[i].GameType}
${parseFloat(data.TopWins[i].BetAmount).toFixed(2) + " " + data.TopWins[i].CurrencyCode}
${parseFloat(data.TopWins[i].WinAmount).toFixed(2) + " " + data.TopWins[i].CurrencyCode}
`
} else {
htmlTopWins = `
${data.TopWins[i].MaskDisplayName}
${parseFloat(data.TopWins[i].BetAmount).toFixed(2) + " " + data.TopWins[i].CurrencyCode}
${parseFloat(data.TopWins[i].Attribute2).toFixed(2) + " " + data.TopWins[i].CurrencyCode}
${parseFloat(data.TopWins[i].WinAmount).toFixed(2) + " " + data.TopWins[i].CurrencyCode}
`
}
$(".top-wins-tbody").append(htmlTopWins)
}
}
if (data.LastWins) {
for (let i = 0; i < data.LastWins.length; i++) {
let htmlLastWins;
if (data.TopWins[i].GameCategory !== "JetX") {
htmlLastWins = `
${data.LastWins[i].MaskDisplayName}
${data.LastWins[i].GameType}
${parseFloat(data.LastWins[i].BetAmount).toFixed(2) + " " + data.LastWins[i].CurrencyCode}
${parseFloat(data.LastWins[i].WinAmount).toFixed(2) + " " + data.LastWins[i].CurrencyCode}
`
} else {
htmlLastWins = `
${data.LastWins[i].MaskDisplayName}
${parseFloat(data.LastWins[i].BetAmount).toFixed(2) + " " + data.LastWins[i].CurrencyCode}
${parseFloat(data.LastWins[i].Attribute2).toFixed(2) + " " + data.LastWins[i].CurrencyCode}
${parseFloat(data.LastWins[i].WinAmount).toFixed(2) + " " + data.LastWins[i].CurrencyCode}
`
}
$(".current-wins-tbody").append(htmlLastWins)
}
}
let mobileString = bowser.mobile ? "Mobile" : "";
if (data.SimilarGames) {
for (let i = 0; i < data.SimilarGames.length; i++) {
let htmlForSimilarGames;
htmlForSimilarGames = `
`
$(".statistic-page-footer").append(htmlForSimilarGames)
}
let leftSimilarSpace = ` `
$(".statistic-page-footer").prepend(leftSimilarSpace)
let rightSimilarSpace = ` `
$(".statistic-page-footer").append(rightSimilarSpace)
}
$(".statistic-page-footer").scrollLeft(($(".statistic-page-footer").get(0).scrollWidth - $(".statistic-page-footer").innerWidth()) / 2)
//if(data.SimilarGames.length <= 4){
// $(".statistic-page-footer").addClass("hidden-right hidden-left")
//}
if ((data.HistoryUrl !== null || data.HistoryUrl !== undefined) && (gameName.toLowerCase() !== 'football' && gameName.toLowerCase() !== 'bookofwin')) {
// $("#historyIframe").attr("src",data.HistoryUrl)
}
}
}
$(document).on(clickEvent, '.menu-popup-close', function (event) {
$("#menu-popup-parent").fadeOut(100);
$('.menu-popup-page-div').removeClass('active');
$('.menu-popup-page-rules').addClass('active');
$('.footer-navigation a').removeClass('active');
$('.footer-page-rules').addClass('active');
buttonClickSound();
});
function getUrl(hiddenGameName, hiddenTokenKey, hiddenCurrencyCode) {
let url = window.location.href;
url = url.split('.aspx?');
url = url[0];
let urlArray = url.split("/");
let promotionsUrl = urlArray[0] + "//";
for (let i = 1; i < urlArray.length - 1; i++) {
if (urlArray[i] !== '') promotionsUrl += urlArray[i] + '/';
}
return `${promotionsUrl}menuapi/Menu/GetMenu/${hiddenGameName}/${hiddenTokenKey}/${hiddenCurrencyCode}`;
}
function setWinsText() {
let strTopWins = $(".top-wins-text").html();
let strCurrentWins = $(".current-wins-text").html();
let resTopWins;
let resCurrentWins;
if ($(window).height() < $(window).width()) {
resCurrentWins = strCurrentWins.replace(/\ /, ' ')
resTopWins = strTopWins.replace(/\ /, ' ')
} else {
resCurrentWins = strCurrentWins.replace(' ', ' ')
resTopWins = strTopWins.replace(' ', ' ')
}
document.querySelector(".top-wins-text.mobile").innerHTML = resTopWins;
document.querySelector(".current-wins-text.mobile").innerHTML = resCurrentWins;
}
$(window).resize(function () {
setWinsText()
});
let menuIconStatus = "Menu"
window.addEventListener("message", function (event) {
let message = event.data;
if (message.name === 'menu-status') {
menuIconStatus = event.data.menuClickCheck
let gameCategory = $("#body").attr("data-category");
if (gameCategory === "Slots" && menuIconStatus === "Menu") {
$("#menu-popup-parent").fadeIn(100)
}
} else if ($("#HiddenGameName").val().toLowerCase() === "bank" && message.name === 'play-bonus') {
$(".open-menu").css("visibility", "hidden")
} else if ($("#HiddenGameName").val().toLowerCase() === "bank" && message.name === 'finish-bonus') {
$(".open-menu").css("visibility", "visible")
}
});
$(document).on(clickEvent, '.menu-icon-without-line.open-menu', function (event) {
iframe.contentWindow.postMessage({ name: 'open-mobile-menu' }, "*");
iframe.contentWindow.postMessage({ name: "help-gameinfo-data" }, "*");
let gameCategory = $("#body").attr("data-category");
if (gameCategory === "XGames" || gameCategory === "Keno" || (!bowser.mobile && gameName.toLowerCase() === "football") || (!bowser.mobile && gameName.toLowerCase() === "bookofwin")) {
$("#menu-popup-parent").fadeIn(100)
}
setWinsText()
let hiddenCurrencyCode = $("#HiddenCurrencyCode").val();
let hiddenTokenKey = $("#HiddenTokenKey").val();
let hiddenGameName = $("#HiddenGameName").val().charAt(0).toUpperCase() + $("#HiddenGameName").val().slice(1);
let url = `/menuapi/Menu/GetMenu/${hiddenGameName}/${hiddenCurrencyCode}`
let gameUrl = getUrl(hiddenGameName, hiddenTokenKey, hiddenCurrencyCode)
fetch(gameUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
.then((data) => {
let similarGameArrow = ` `
$(".statistic-page-footer").empty()
$(".statistic-page-footer").append(similarGameArrow)
$(".current-wins-tbody").empty()
$(".top-wins-tbody").empty()
menuData(data)
showHelp()
})
});
$(document).on(clickEvent, '.menu-popup .footer-navigation > a', function (event) {
$(".menu-popup .footer-navigation > a").removeClass("active")
$(this).addClass("active")
if (!$(".menu-popup-page-" + $(this).attr("data-page")).hasClass("active")) {
$(".menu-popup-page-div").removeClass("active")
$(".menu-popup-page-" + $(this).attr("data-page")).addClass("active")
}
buttonClickSound();
if ($(this).attr('data-page') === 'history') {
$('.tab').removeClass('active')
$('.tab[data-tab="bet-history"]').addClass('active')
$('.history-content').attr('data-active-tab', 'bet-history')
$('.history-list-content').animate({ scrollTop: 0 }, "smooth")
$('.menu-popup-content').addClass('history-active')
$('.scroll-up-btn').fadeOut(0)
GetSpinHistoryData()
} else $('.menu-popup-content').removeClass('history-active')
});
$(document).on(clickEvent, '.top-curent-wins-tab', function (event) {
$(".top-curent-wins-tab").removeClass("active")
$(this).addClass("active")
if (!$(".statistic-tab-" + $(this).attr("data-top-current-tab")).hasClass("active")) {
$(".statistic-tab-current-top-wins").removeClass("active")
$(".statistic-tab-" + $(this).attr("data-top-current-tab")).addClass("active")
}
});
$(document).on(clickEvent, '.similar-game-arrow-right', function (event) {
$(".statistic-page-footer").animate({ scrollLeft: '+=350' }, 500);
});
$(document).on(clickEvent, '.similar-game-arrow-left', function (event) {
$(".statistic-page-footer").animate({ scrollLeft: '-=350' }, 500);
});
$(document).on(clickEvent, '.similar-game-arrow-up-desktop', function (event) {
$(".statistic-page-footer").animate({ scrollTop: '-=350' }, 500);
});
$(document).on(clickEvent, '.similar-game-arrow-down-desktop', function (event) {
$(".statistic-page-footer").animate({ scrollTop: '+=350' }, 500);
});
$(document).on("touchstart", '.statistic-page-footer', function () {
document.querySelector('.menu-popup-content').removeEventListener('swl', swipeLeft, false);
document.querySelector('.menu-popup-content').removeEventListener('swr', swipeRight, false);
});
$(document).on("touchmove", '.statistic-page-footer', function () {
document.querySelector('.menu-popup-content').removeEventListener('swl', swipeLeft, false);
document.querySelector('.menu-popup-content').removeEventListener('swr', swipeRight, false);
});
$(document).on("touchend", '.statistic-page-footer', function () {
document.querySelector('.menu-popup-content').addEventListener('swl', swipeLeft, false);
document.querySelector('.menu-popup-content').addEventListener('swr', swipeRight, false);
});
$(document).on(clickEvent, '#menu-popup .rules-item .rules-title', function (event) {
let index = $('#menu-popup .rules-item').index($(this).parent());
if ($('#menu-popup .rules-item:eq(' + index + ')').hasClass('active')) {
$('#menu-popup .rules-item:eq(' + index + ')').removeClass('active');
$('#menu-popup .rules-item:eq(' + index + ') .rules-content').slideToggle(200);
} else {
$('#menu-popup .rules-item:eq(' + index + ')').addClass('active');
$('#menu-popup .rules-item:eq(' + index + ') .rules-content').slideToggle(200);
}
});
function getSimilarGameUrl(category, hiddenGameType, hiddenGameName, clientId, hiddenCurrencyCode, language, returnUrl) {
let url = window.location.href;
url = url.split('.aspx?');
url = url[0];
let urlArray = url.split("/");
let promotionsUrl = urlArray[0] + "//";
for (let i = 1; i < urlArray.length - 1; i++) {
if (urlArray[i] !== '') promotionsUrl += urlArray[i] + '/';
}
return `${promotionsUrl}/menuapi/Menu/GetRedirectUrl/${category}/${hiddenGameType}/${hiddenGameName}/${clientId}/${hiddenCurrencyCode}/${language}?returnUrl=${returnUrl}`;
}
function openSimilarGame(game, category) {
let hiddenCurrencyCode = $("#HiddenCurrencyCode").val();
let hiddenGameName = game;
let hiddenGameType = game;
let mobileString = bowser.mobile ? "Mobile" : "";
if (category == "Slots" || category == "Slots" + mobileString) {
hiddenGameType = $("#HiddenGameType").val();
}
let clientId = $("#HiddenClientId").val();
let language = $("#HiddenLanguageParameter").val();
let returnUrl = encodeURIComponent($("#HiddenReturnUrl").val());
let similarGameUrl = getSimilarGameUrl(category, hiddenGameType, hiddenGameName, clientId, hiddenCurrencyCode, language, returnUrl)
fetch(similarGameUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
.then((data) => {
$("#HiddenGameName").val(game)
loadHelp()
$("#game-frame").attr("src", data)
HelpDiv();
})
}
$(document).on(clickEvent, '.box-for-similar-games', function (event) {
$("#jackpotIframe").css('width', '0')
$("#menu-popup-parent").fadeOut(200);
$(".show-menu-container").fadeOut(200);
document.querySelector(".input-for-sound").checked = false;
openSimilarGame($(this).attr("data-game"), $(this).attr("data-category"));
document.querySelector(".input-for-background-music").checked = true;
$('.XplusY-promotion-icon').fadeOut(200);
$('.prize-drop-promotion-icon').fadeOut(100)
$('.random-points-icon').fadeOut(50);
$('.loader-clock').fadeOut(0);
});
function loadHelp() {
let hiddenGameName = $("#HiddenGameName").val().charAt(0).toUpperCase() + $("#HiddenGameName").val().slice(1);
$("#help-links").html(` `).ready(() => {
$("#help").load(`Menu/Help/${hiddenGameName}.html`, () => {
HelpDiv();
getCaption();
$('.loader-help-currency').attr('data-currency', currencyCode);
});
})
}
$(document).on('click', '.game-icon-bt', function () {
$('.menu-div-sub').slideToggle(200);
$('.game-icon-bt').toggleClass('active');
});
$(document).on('click', '.game-exit-bt', function () {
iframe.contentWindow.postMessage({ name: "exit-game" }, "*");
});
$(document).on('click', '.game-sound-bt', function () {
$(this).toggleClass("active")
iframe.contentWindow.postMessage({ name: "sound-toggle" }, "*");
});
$(document).on('click', '.game-music-bt', function () {
$(this).toggleClass("active")
iframe.contentWindow.postMessage({ name: "background-music-toggle" }, "*");
});
$(document).on('click', '.game-help-bt', function () {
if ($("#history-iframe-desktop").is(":hidden")) {
iframe.contentWindow.postMessage({ name: "game-help" }, "*");
}
});
$(document).on('click', '.game-fullscreen-bt', function () {
if ($(this).hasClass('active')) {
exitFullscreen();
} else {
launchFullscreen(document.documentElement);
}
});
let desktopHistoryStatus = '';
$(document).on('click', '.game-history-bt', function () {
window.addEventListener("message", function (event) {
let message = event.data; if (message.name === "menu-desktop-history-status") {
if (event.data.historyDesktopCheck === "disabled") {
desktopHistoryStatus = false
} else {
desktopHistoryStatus = true;
if (event.data.helpStatus === true) {
// $(".history-iframe-desktop-container").fadeIn(100)
}
}
}
});
iframe.contentWindow.postMessage({ name: 'open-desktop-history' }, "*");
let hiddenCurrencyCode = $("#HiddenCurrencyCode").val();
let hiddenTokenKey = $("#HiddenTokenKey").val();
let hiddenGameName = $("#HiddenGameName").val().charAt(0).toUpperCase() + $("#HiddenGameName").val().slice(1);
let url = `/menuapi/Menu/GetMenu/${hiddenGameName}/${hiddenCurrencyCode}`
let gameUrl = getUrl(hiddenGameName, hiddenTokenKey, hiddenCurrencyCode)
fetch(gameUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
.then((data) => {
if (data.HistoryUrl !== null || data.HistoryUrl !== undefined) {
// $("#history-iframe-desktop").attr("src",data.HistoryUrl)
}
})
});
/* Spin historis start */
$(document).on(clickEvent, '.tab', function () {
if (!$(this).hasClass('active')) buttonClickSound();
$('.tab').removeClass('active');
$(this).addClass('active');
$('.scroll-up-btn').fadeOut(0)
$('.history-content').attr('data-active-tab', $(this).attr("data-tab"));
if ($('.history-content').attr('data-active-tab') === 'bet-history') {
$('.scroll-up-btn').trigger(clickEvent)
$('.history-list-content').html(lastRoundsList)
} else {
$('.scroll-up-btn').trigger(clickEvent)
$('.top-wins-list-content').html(topWinsList)
}
});
$('.history-list-content, .top-wins-list-content').on('scroll', function (event) {
var scrollTop = $(this).scrollTop();
if (scrollTop > 0) {
$('.scroll-up-btn').fadeIn(500)
} else {
$('.scroll-up-btn').fadeOut(500)
}
})
$(document).on(clickEvent, '.scroll-up-btn', function () {
if ($('.history-content').attr('data-active-tab') === 'bet-history') {
$('.history-list-content').animate({ scrollTop: 0 }, "smooth")
} else {
$('.top-wins-list-content').animate({ scrollTop: 0 }, "smooth")
}
})
/* Spin historis end */
if(bowser.mobile) $('#help').addClass('loader-help-mobile');
});
let addressBar = {
verticalView: window.innerWidth < window.innerHeight,
width: window.innerWidth,
height: window.innerHeight,
visible: true,
};
window.addEventListener('resize', function () {
let gameName = $("#HiddenGameName").val();
if (gameName !== 'JetX') return false;
let userAgent = navigator.userAgent;
let isMobile = userAgent.match(/(Android|iPhone|iPad|iPod|Windows Phone)/i);
if (isMobile) {
isMobile = true;
} else {
isMobile = false;
}
let browser = userAgent.match(/(Chrome|Firefox|Safari|Edge|Opera)/i);
if (browser) {
browser = browser[1];
} else {
browser = "Unknown";
}
if (!isMobile || browser === 'Firefox') return false;
let keyboardIsVisible = false;
if (!keyboardIsVisible) {
let visible = true;
if (window.innerWidth < window.innerHeight) {
if (addressBar.verticalView) {
if (window.innerHeight > addressBar.height) {
visible = false;
} else {
visible = true;
}
addressBar.height = window.innerHeight;
} else {
if (addressBar.visible) {
addressBar.height = window.innerHeight;
} else {
visible = false;
}
}
} else {
if (!addressBar.verticalView) {
if (window.innerWidth > addressBar.width) {
visible = false;
} else {
visible = true;
}
addressBar.width = window.innerWidth;
} else {
if (addressBar.visible) {
addressBar.width = window.innerWidth;
} else {
visible = false;
}
}
}
$('#game-frame').css({ 'width': (visible ? '100%' : '100vw'), 'height': (visible ? '100%' : '100vh') });
addressBar.verticalView = window.innerWidth < window.innerHeight;
addressBar.visible = visible;
}
});
/* Spin histories methods start */
var lastRoundsList = ''
var topWinsList = ''
const formatter = new Intl.DateTimeFormat("en-GB", {
year: "numeric",
month: "2-digit",
day: "2-digit",
})
function GetSpinHistoryData() {
let newSlots = [{
'GeniesBonanza': 'genies-bonanza',
'MultiHotWays': 'multi-hot-ways',
'WildsAndGods': 'wilds-and-gods',
'FoxyHot20': 'foxyhot20',
'WildMultiStars': 'wild-multi-stars',
'BookOfFuturia': 'book-of-futuria',
'BookOfBonanza': 'book-of-bonanza',
'HotSamba': 'hotSamba'
}]
let clientId = $("#HiddenClientId").val()
let gameName = $("#HiddenGameName").val()
$('.history-list-header').html(
`${GetCaption('Menu.popup.history.list.header.game')} `
+ `${GetCaption('Menu.popup.history.list.header.bet')} `
+ `${GetCaption('Menu.popup.history.list.header.win')} `)
if (Object.keys(newSlots[0]).indexOf(gameName) > -1) {
$('.history-list-header').append(`${GetCaption('Menu.popup.history.list.replay')} `)
}
let methods = [`GetClientLastRounds/${clientId}/${gameName}/100`, `GetClientBiggestWins/${clientId}/${gameName}/100/10`]
methods.forEach(method => {
fetch(`https://rezobet.com:8092/SpinHistory/api/spinhistory/${method}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
.then((data) => {
let list = ''
data?.rounds?.map(round => {
list += `
${round.gameType.replace(/([a-z])([A-Z0-9])/g, '$1 $2')}
${formatter.format(new Date(round.endDate)).split('/').join('.')}
${new Date(round.endDate).toLocaleTimeString('it-IT')}
${(Math.trunc(round.totalPlacedBet * 100) / 100).toFixed(2)}
${round.currencyCode}
${round.totalWon.toFixed(2)}
${round.currencyCode}
${Object.keys(newSlots[0]).indexOf(round.gameType) > -1 ?
`
` : ''}
`
})
if (method.includes('GetClientLastRounds')) {
lastRoundsList = list
} else topWinsList = list
if ($('.history-content').attr('data-active-tab') === 'bet-history') {
$('.history-list-content').html(lastRoundsList)
} else $('.top-wins-list-content').html(topWinsList)
})
})
}
var spinHistoryData = {}
window.addEventListener('message', (event) => {
if (event.data.name === 'spin-history') {
spinHistoryData = event.data.data
}
}, false);
function passData(roundId, gameName, fileName) {
if (!spinHistoryData['StaticContentAddress']) spinHistoryData['StaticContentAddress'] = 'https://static.rezobet.com/cache/b7'
spinHistoryData['RoundId'] = roundId
spinHistoryData['GameType'] = gameCategory
spinHistoryData['GameName'] = gameName
spinHistoryData['FileName'] = fileName
const jsonData = JSON.stringify(spinHistoryData)
const base64Data = btoa(unescape(encodeURIComponent(jsonData)))
const lang = new URLSearchParams(window.location.search).get('Lang')
const longUrl = `https://rezobet.com:8092/SpinHistoryClient/?data=${base64Data}&lang=${lang}`
const apiUrl = `https://tineurl.com/api-create.php?url=${encodeURIComponent(longUrl)}`
fetch(apiUrl, {mode: 'no-cors'},
{
headers: {
'Access-Control-Allow-Origin': '*'
}
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.log('error', error))
window.open(longUrl) //http://127.0.0.1:5500/app/dist/index.html, http://localhost:5173
}
// var data = {
// "domain": "go.rezobet.com",
// "originalURL": window.location.href
// };
// fetch('https://api.short.io/links/public', {
// method: 'post',
// headers: {
// 'accept': 'application/json',
// 'Content-Type': 'application/json',
// 'authorization': 'pk_ziNZOJ6kY7I6xYGv'
// },
// body: JSON.stringify(data)
// }).then(function (response) {
// return response.json();
// }).then(function (data) {
// console.log(data.shortURL)
// })
// .catch(error => console.log('error', error));
// const apiUrl = `https://tineurl.com/api-create.php?url=${encodeURIComponent(base)}`
// fetch(apiUrl, {mode: 'no-cors'},
// {headers: {
// 'Access-Control-Allow-Origin': '*'
// }
// })
// .then(response => response.text())
// .then(data => console.log(data))
// .catch(error => console.log('error', error))
/* Spin histories methods end */
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
let regex = new RegExp("[\\?&]" + name + "=([^]*)")
let results = null;
try {
results = regex.exec(location.search);
} catch (e) {
return null;
}
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}